package mymac.com.test_viewpagefragment_1;

import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.support.v4.app.FragmentPagerAdapter;


import java.util.ArrayList;

/**
 * Created by mymac on 2017/3/10.
 */

public class MyFmAdapter extends FragmentPagerAdapter {
    private Context fmContext;
    private ArrayList<Fragment> arrayList;

    public MyFmAdapter(FragmentManager fm, Context context, ArrayList<Fragment> fmList) {
        super(fm);
        fmContext = context;
        if (fmList != null){
            arrayList = fmList;
        } else {
            arrayList = new ArrayList<Fragment>();
        }
    }


    @Override
    public Fragment getItem(int position) {
        return arrayList.get(position);
    }

    @Override
    public int getCount() {
        return arrayList.size();
    }
}
